
Page({
  onLoad: function (option) {
    this.getOpenIdTap();
  },
  getOpenIdTap: function () {
    var that = this;
    wx.login({
      success: function (res) {
        wx.request({
          //获取openid接口
          url: 'https://api.weixin.qq.com/sns/jscode2session',
          data: {
            appid: 'wx4403ea586c29c983',
            secret: '88a9d029fc5dc5efcfb523f305b2b745',
            js_code: res.code,
            grant_type: 'authorization_code'
          },
          method: 'GET',
          success: function (res) {
            console.log(res.data)
            console.log(res.data.openid)
            console.log(res.data.session_key)
          }
        })
      }
    })
  }
})